package com.firefly.job.jobs;

import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @description: 具体的任务,不并发执行
 * @author: lzg(萤火科技 ： 854378082 @ qq.com)
 * @date: 2023/6/1
 **/
@DisallowConcurrentExecution
public class JobTest1 implements Job {
    private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    private void before() {
        System.out.println("任务1：开始执行-" + dateFormat.format(new Date()));
    }

    @Override
    public void execute(JobExecutionContext arg0) throws JobExecutionException {
        before();
        System.out.println("任务1：业务逻辑。。。");
        after();
    }

    private void after() {
        System.out.println("任务1：执行结束");
        System.out.println();
    }
}
